﻿function ChangeCountry(country_value,lang,selname)
{	
	var ext_display = 'ext_'+selname;
	
	if ( country_value != "VN" )
	{
		newDivStr="<input type=text name='"+selname+"' id='"+selname+"' style='width:250px;' class='textfiled'>";
		getobj(ext_display).innerHTML=newDivStr;
	}
	else
	{
		var mydata =  "do=list_city&country="+country_value+'&selname='+selname+'&lang='+lang;
		$.ajax({
			 type: "GET",
			 url: ROOT+"modules/product/ajax/ajax_product.php",
			 data: mydata,
			 success: function(html){
					$("#"+ext_display).html(html);
			 }
		 });	 
		
	}
}

function select_vote(num) {
	var uservote=num;
	for (i=1;i<=5;i++) {
		objname='vote_'+i;
		var imgshow=(i<=num) ? 'star2.gif':'star0.gif';
		src =  ROOT+"modules/product/images/"+imgshow;
		$("#"+objname).attr("src", src); 
	}	
	
  //$('.validate').filter('.error').css('background-color', 'red');
 	
	$('#hvote').val(num);
	
}


function load_image(src)
{
	/*$("#divImage img").fadeTo('slow', 0.1, function() {
		$(this).attr( "src", src ).animate({ opacity: 1.0 }, 500) ;
	});*/
	$("#divImage img").attr( "src", src );
	
	$("#divImage a").attr( "href", src ) ;
} 
 
/*COMMENT*/
 
function show_comment(id,lang,p) {
	
	$.ajax({
		 type: "GET",
		 url: ROOT+'modules/product/ajax/_show_comment.php',
		 data: "id="+id+'&lang='+lang+'&p='+p,
		 success: function(html){
			  $("#ext_comment").html(html);
		 }
	 });
}

function goToBrand(id,lang) {
	if(id>0) {
		var mydata =  "do=go_brand&id="+id+'&lang='+lang  ; 
		$.ajax({
			async: true,
			dataType: 'json',
			url: ROOT+'load_ajax.php',
			type: 'POST',
			data: mydata ,
			success: function (data) {		
				window.location.href = data.ReturnUrl;
			}
		}) ;
	} 
	
}

